home *** CD-ROM | disk | FTP | other *** search
- // UtilFrameRoute.js
- // Copyright (c) 1999 MGI Software Corp. All Rights Reserved
- // <Script>
-
- ////////////////////////////////////////////////////////////////
- //
- // Miscelaneous stuff
- //
-
- function _SmartJump( fTarget, sNewTarget )
- {
- var sFullPath;
-
- sFullPath = ResolvePath( window.location.href, sNewTarget );
-
- return 1;
- }
-
- // Absolute path version
- function _SmartJumpAbs( fTarget, sNewTarget )
- {
- return 1;
- }
-
- var RoutingTable = new Array;
-
- // Remove a routing from the table
- function _DeleteRouting( Dest, FrameObject )
- {
- var i;
-
- // Find the object to delete
- for( i=0; i<RoutingTable.length; i++ )
- {
- // Found it
- if( RoutingTable[i].Dest == Dest && RoutingTable[i].FrameObject == FrameObject )
- {
- // Mark as inactive
- RoutingTable[i].FrameObject = null;
- RoutingTable[i].Dependants = null;
-
- // If not already queued, disable it
- if( RoutingTable[i].QueueMode == 2 )
- {
- _SetQueueMode( Dest, -1, 0 );
- }
-
- return 1; // Success
- }
- }
-
- alert("Root.HTML, _DeleteRouting(): Routing " + Dest +" not found.");
- return 0; // Failed!
- }
-
- // Add a routing to the table
- function _AddRouting( Dest, FrameObject, Dependants )
- {
- var undefined;
- var i;
- var j;
- var k;
-
- // Default Dependants to none
- Dependants = Dependants == undefined ?"" : Dependants;
-
- // Make sure the routing does not already exist
- for( i=0; i<RoutingTable.length; i++ )
- {
- if( RoutingTable[i].Dest == Dest )
- {
- // Enabled?
- if( RoutingTable[i].FrameObject != null )
- {
- alert("Root.html, AddRouting(): Rooting " + Dest +" already exists.");
- return 0; // Failed!
- }
-
- // Modify
- RoutingTable[i].FrameObject = FrameObject;
- RoutingTable[i].Dependants = new Array;
-
- // Parse the dependants
- j=0;
- k=Dependants.indexOf(",", 0);
- while( k >= 0 )
- {
- // Store
- RoutingTable[i].Dependants[RoutingTable[i].Dependants.length++] =
- Dependants.substr(j, k-j);
-
- j = k+1; // 1 is ",".length
- k=Dependants.indexOf(",", j);
- }
- if( j < Dependants.length ) // Last one not followed by comma
- {
- RoutingTable[i].Dependants[RoutingTable[i].Dependants.length++] =
- Dependants.substr(j);
- }
-
- _SetQueueMode( Dest, 2 );
- return 1; // Success
- }
- }
-
- RoutingTable.length += 1;
- RoutingTable[i] = new Object;
-
- RoutingTable[i].Dest = Dest;
- RoutingTable[i].FrameObject = FrameObject;
- RoutingTable[i].QueueMode = 2;
- RoutingTable[i].CallQueue ="";
-
- RoutingTable[i].Dependants = new Array;
-
- // Parse the dependants
- j=0;
- k=Dependants.indexOf(",", 0);
- while( k >= 0 )
- {
- // Store
- RoutingTable[i].Dependants[RoutingTable[i].Dependants.length++] =
- Dependants.substr(j, k-j);
-
- j = k+1; // 1 is ",".length
- k=Dependants.indexOf(",", j);
- }
- if( j < Dependants.length ) // Last one not followed by comma
- {
- RoutingTable[i].Dependants[RoutingTable[i].Dependants.length++] =
- Dependants.substr(j);
- }
-
- return 1; // Success
- }
-
- // Route a call to the proper destination
- function _RouteCall( Dest, strEvalCode )
- {
- var i;
- // Dest is a Div
-
- // Find the destination
- for( i=0; i<RoutingTable.length; i++ )
- {
- if( RoutingTable[i].Dest == Dest )
- {
- switch( RoutingTable[i].QueueMode ) {
- case -1: // Disabled
- return -1;
- case 0: // Queue
- case 1:
- RoutingTable[i].CallQueue = RoutingTable[i].CallQueue.concat(strEvalCode);
- return 0;
- case 2: // Normal
- if( RoutingTable[i].FrameObject == null )
- {
- // Target is inactive
- break;
- }
- top.debugalert("RouteCall("+strEvalCode+")");
- return RoutingTable[i].FrameObject.EvalCode( strEvalCode );
- //return window.frames["Liquid"].EvalCode( strEvalCode );
- //return EvalCode( strEvalCode );
- }
- }
- }
-
- alert("Root.html, _RouteCall(): Routing " + Dest +" not found." );
-
- return 0; // Failed (routing not found)
- }
-
- // Set Queue mode
- // Mode = 2: Normal (setting this executes the queue);
- // Mode = 1: Indirectly queued (through dependancies)
- // Mode = 0: Queue calls;
- // Mode =-1: Ignore calls;
- function _SetQueueMode( Dest, Mode, Recurse )
- {
- var undefined;
- var i;
- var j;
-
- // Default Recurse to False
- Recurse = Recurse == undefined ? false : Recurse;
-
- // Insure Mode is in range
- if( Mode < -1 || Mode > 2 )
- {
- alert("root.html, _SetQueueMode(): Mode out of range.");
- return 0;
- }
-
- // Find the routing to set
- for( i=0; i<RoutingTable.length; i++ )
- {
- // Found it
- if( RoutingTable[i].Dest == Dest )
- {
- // Setting normal mode, execute the queue
- if( Mode == 2 && RoutingTable[i].FrameObject != null )
- {
- RoutingTable[i].QueueMode = Mode;
- j = RoutingTable[i].FrameObject.EvalCode( RoutingTable[i].CallQueue );
- //j = EvalCode( RoutingTable[i].CallQueue );
-
- RoutingTable[i].CallQueue ="";
- return j;
- }
-
- // Clear the queue for explicit queuing and disabling, unless implicit queuing
- // has already been set
- if( (Mode == -1) ||
- (Mode == 0 && RoutingTable[i].QueueMode == 0) ||
- (Mode == 1 && RoutingTable[i].QueueMode == 0) ||
- (Mode == 1 && RoutingTable[i].QueueMode == 1) )
- {
- RoutingTable[i].CallQueue ="";
- }
-
- RoutingTable[i].QueueMode = Mode;
-
- // Recurse dependants
- if( Recurse && RoutingTable[i].Dependants != null )
- {
- for( j=0; j<RoutingTable[i].Dependants.length; j++ )
- {
- _SetQueueMode( RoutingTable[i].Dependants[j], (Mode==0 ? 1 : Mode), 1 );
- }
- }
-
- return 1; // Return normally
- }
- }
-
- // Does not exist? Create it to null
- _AddRouting( Dest, null );
-
- // Try again!
- _SetQueueMode( Dest, Mode, Recurse );
-
- return 0;
- }
-
- ///////////////////////////////////////////////////////////////////////////////
- //
- // Routed calls
- //
-
- function _RPASetTarget(NewTarget)
- {
- //if( SmartJumpAbs( window.frames["RightPaneA"], NewTarget ) )
- //{
- _SetQueueMode( "RightPaneA", 0, 1 );
- //}
- }
-
- function _TKSetTarget(NewTarget)
- {
- //if( SmartJumpAbs( window.frames["ActivityList"], NewTarget ) )
- //{
- _SetQueueMode( "ActivityList", 0, 1 );
- //}
- }
-
-
- function _TSetTarget(NewTarget)
- {
- //if( SmartJumpAbs( window.frames["Tools"], NewTarget ) )
- {
- SetQueueMode( "Tools", 0, 1 );
- }
- }
-
- function _WSetTarget( NewTarget )
- {
- //if( SmartJumpAbs( window.frames["WorkArea"], NewTarget ) )
- {
- SetQueueMode("WorkArea", 0, 1);
- }
- }
-
- function _BTSetTarget(NewTarget)
- {
- //if( SmartJumpAbs( window.frames["BuddyTools"], NewTarget ) )
- {
- SetQueueMode("BuddyTools", 0, 1);
- }
- }
-
- function _GetLanguageFolder()
- {
- return "English";
- }
-
-
-
- ///////////////////////////////////////////////////////////////////////////////
- //
- // Set up
- //
-
-
-
- // Register all global targets to null before anyone else and queue them
- function AddAllRouting()
- {
- _AddRouting("Liquid", null);
- _SetQueueMode("Liquid", 1 );
- // _AddRouting("ActivityList", null);
- // _SetQueueMode("ActivityList", 1 );
- // _AddRouting("Menu", null);
- // _SetQueueMode("Menu", 1 );
- // _AddRouting("Browser", null);
- // _SetQueueMode("Browser", 1 );
- // _AddRouting("Tools", null);
- // _SetQueueMode("Tools", 1 );
- // _AddRouting("ToolKits", null);
- // _SetQueueMode("ToolKits", 1 );
- // _AddRouting("CommandBar", null);
- // _SetQueueMode("CommandBar", 1 );
- // _AddRouting("ShelfBar", null);
- // _SetQueueMode("ShelfBar", 1 );
- // _AddRouting("WorkArea", null);
- // _SetQueueMode("WorkArea", 1 );
- // _AddRouting("Shelves", null);
- // _SetQueueMode("Shelves", 1 );
- // _AddRouting("BuddyTools", null);
- // _SetQueueMode("BuddyTools", 1 );
- // _AddRouting("P_Tools", null);
- // _SetQueueMode("P_Tools", 1 );
- // _AddRouting("P_WorkArea", null);
- // _SetQueueMode("P_WorkArea", 1 );
- // _AddRouting("P_BuddyTools", null);
- // _SetQueueMode("P_BuddyTools", 1 );
-
- }
-